<?
require("config.php");

require($rela_path . "bin/country.php");


$location_status .= "| Edit";
$show_backnav = "subscription_menu";
$menuname = NULL;
$menutarget = NULL;

if (NULL!=$action){

   $field = array(
"code",
"first_name",
"last_name",
"position",
"company",
"c_address",
"p_address",
"email",
"o_phone",
"m_phone",
"h_phone",
"aid",
"date",
"status",
	);


   $content = array(
	$code,
$first_name,
$last_name,
$position,
$company,
$c_address,
$p_address,
$email,
$o_phone,
$m_phone,
$h_phone,
$aid,
$date,
$status,
	);

	$exp = "id=$id";

   myUpdate($table,$field,$content,$exp);


   header("location:" . $rela_path . "share/msg.php?v=73");

   exit();

}else{

  if (!checkRecord($table,$id)){

	header("location:" . $rela_path . "share/msg.php?v=9002");

	exit();
  
  }

}


$Query = "SELECT 
id,
code,
first_name,
last_name,
position,
company,
c_address,
p_address,
email,
o_phone,
m_phone,
h_phone,
aid,
date,
status
FROM $table WHERE id=$id LIMIT 1";

$r=myQuery($Query);

$code=$r[0][1];
$first_name=$r[0][2];
$last_name=$r[0][3];
$position=$r[0][4];
$company=$r[0][5];
$c_address=$r[0][6];
$p_address=$r[0][7];
$email=$r[0][8];
$o_phone=$r[0][9];
$m_phone=$r[0][10];
$h_phone=$r[0][11];
$aid=$r[0][12];
$date=$r[0][13];
$status=$r[0][14];

require($rela_path . "inc/header.php");

?>

<form action="" method="post" enctype="multipart/form-data" name="form1">
<input name="action" type="hidden" value="edit">
<input name="id" type="hidden" value="<?print($id)?>">
<input name="code" type="hidden" value="<?print($code)?>">

<input name="date" type="hidden" value="<?=$date?>">



<table width="95%" border="0" align="center">
  <tr> 
    <td valign="top"> 
      <table border="0" cellspacing="5" cellpadding="1">
        <tr> 
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="tdheader">Code :</td>
          <td>
            <?print($code)?>
          </td>
        </tr>
        <tr>
          <td class="tdheader">Date:</td>
          <td>
            <?=$date?>
          </td>
        </tr>
        <tr>
          <td class="tdheader">Acuity Evening: </td>
          <td>
            <?



$Query = "select id, presented from med_aevening";
$r = myQuery($Query);

$sourceData = array();
$sourceLabel = array();
for ($i=0;$i<count($r);$i++){

	array_push($sourceData,$r[$i][0]);
array_push($sourceLabel,$r[$i][1]);
	}


FFPSelectBox("aid",$aid,$sourceData,$sourceLabel);

?>
          </td>
        </tr>
        <tr>
          <td class="tdheader">Status :</td>
          <td>
            <select name="status" class="select" id="status">
              <option value="Registered" <?php if ($status == "Registered") echo "selected"; ?>>Registered</option>
              <option value="Waiting" <?php if ($status == "Waiting") echo "selected"; ?>>Waiting</option>
              <option value="Cancelled" <?php if ($status == "Cancelled") echo "selected"; ?>>Cancelled</option>
              <option value="Attended" <?php if ($status == "Attended") echo "selected"; ?>>Attended</option>
              <option value="Non-attend" <?php if ($status == "Non-attend") echo "selected"; ?>>Non-attend</option>
            </select>
          </td>
        </tr>
        <tr>
          <td class="tdheader">First Name :</td>
          <td>
            <input name="first_name" type="text" class="text" id="first_name" value="<?=$first_name?>" size="40">
          </td>
        </tr>
        <tr>
          <td class="tdheader">Last Name :</td>
          <td>
            <input name="last_name" type="text" class="text" id="last_name" value="<?=$last_name?>" size="40">
          </td>
        </tr>
        <tr>
          <td class="tdheader">Position :</td>
          <td>
            <input name="position" type="text" class="text" id="position" value="<?=$position?>" size="40">
          </td>
        </tr>
        <tr>
          <td class="tdheader">Company :</td>
          <td>
            <input name="company" type="text" class="text" id="company" value="<?=$company?>" size="40">
          </td>
        </tr>
        <tr>
          <td class="tdheader">Company Address :</td>
          <td>
            <textarea name="c_address" cols="40" rows="5" class="text" id="c_address"><?=$c_address?>
        </textarea>
          </td>
        </tr>
        <tr>
          <td class="tdheader">Private Address :</td>
          <td>
            <textarea name="p_address" cols="40" rows="5" class="text" id="p_address"><?=$p_address?>
        </textarea>
          </td>
        </tr>
        <tr>
          <td class="tdheader">Email :</td>
          <td>
            <input name="email" type="text" class="text" id="email" value="<?=$email?>" size="40">
          </td>
        </tr>
        <tr>
          <td class="tdheader">Office Phone :</td>
          <td>
            <input name="o_phone" type="text" class="text" id="o_phone" value="<?=$o_phone?>" size="40">
          </td>
        </tr>
        <tr>
          <td class="tdheader">Mobile Phone :</td>
          <td>
            <input name="m_phone" type="text" class="text" id="m_phone" value="<?=$m_phone?>" size="40">
          </td>
        </tr>
        <tr>
          <td class="tdheader">Home Phone :</td>
          <td>
            <input name="h_phone" type="text" class="text" id="h_phone" value="<?=$h_phone?>" size="40">
          </td>
        </tr>


        <tr> 
          <td>&nbsp;</td>
          <td><input type="image" src="../../images/bt_cancel.gif" onClick="Redirect('subscription_menu.php',1);return false;"> <input type="image" src="../../images/bt_save.gif">
          </td>
        </tr>
      </table>
      <p><br>
        <br>
        <br>
      <p><br>
        <br>
        <br>
        <br>
      <p> 
      <p> 
      <p> 
      <p> 
      <p> 
      <p> 
      <p> </td>
  </tr>
</table>
<br>
<br>
<br>
<?
require($rela_path . "inc/footer.php");
?>
